import time

import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By

@pytest.fixture(scope='function')
def getlogin():
    driver = webdriver.Edge()
    # 输入网址
    driver.get('file:///D:/gao5/%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F.html')
    time.sleep(15)
    # 输入账号
    driver.find_element(By.ID, 'username').send_keys('admin')
    # 输入密码
    time.sleep(2)
    driver.find_element(By.ID,'password').send_keys('123456')
    # 点击登录
    time.sleep(2)
    driver.find_element(By.XPATH,'//*[@id="loginForm"]/button').click()
    yield driver
    driver.quit()
